#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+10;

int n,a[MAXN],raw[MAXN],cnt[MAXN];

int main()
{
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		raw[i]=a[i];
	}
	sort(raw+1,raw+n+1);
	int lim=unique(raw+1,raw+n+1)-(raw+1);
	for(int i=1;i<=n;i++)
	{
		a[i]=lower_bound(raw+1,raw+lim+1,a[i])-raw;
		cnt[a[i]]++;
	}
	int ans=0;
	for(int i=2;i<=lim;i++)
	{
		if(cnt[i-1]>cnt[i])
		{
			ans+=cnt[i];
			cnt[i]+=cnt[i-1]-cnt[i];
		}
		else ans+=cnt[i-1];
	}
	cout<<n-ans;
	return 0;
}